﻿using rmTest.Common.DataBaseUtil;
using rmTest.Common.ModelUtil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace rmTest.First.Access
{
    public class BaseDataAccess
    {
        public static List<T> GetList<T>() where T : BaseModel, new()
        {
            return SqlHelper.GetAllDataList<T>();
        }

        public static T Get<T>(int id) where T : BaseModel, new()
        {
            return SqlHelper.Get<T>(id);
        }

        public static int InsertDataByModel<T>(T t) where T : BaseModel
        {
            return SqlHelper.InsertDataByModel<T>(t);
        }
        public static int UpdateDataByModel<T>(T t) where T : BaseModel
        {
            return SqlHelper.UpdateDataByModel<T>(t);
        }

        public static int Detele<T>(int id) where T : BaseModel
        {
            return SqlHelper.Delete<T>(id);
        }
    }
}
